﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace week7
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();//关闭窗口
        }

        private void button1_Click(object sender, EventArgs e)
        {
            
            int a, b, c;
            if((text_a.Text=="")||(text_b.Text==""))
            {
                MessageBox.Show(this, "null", "msg", MessageBoxButtons.OK, MessageBoxIcon.Information);//产生出错提示消息盒
                return;
            }
            try
            {
                a = Convert.ToInt32(text_a.Text);
                b = Convert.ToInt32(text_b.Text);
                c = a + b;
                text_c.Text = Convert.ToString(c);
            }
            catch (Exception e1)
            {
                MessageBox.Show(this, e1.Message, "msg", MessageBoxButtons.OK, MessageBoxIcon.Warning);//产生错误提示消息盒
            }
           
        }
    }
}
